package dao.oc_boat_pla;

import java.util.ArrayList;
import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import entitybean.oc_boat_pla.EntityBeanOc_Boat_Pla;
public class DaoImpl_Oc_Boat_Pla extends HibernateDaoSupport implements Dao_Oc_Boat_Pla{

	@SuppressWarnings("unchecked")
	public void Delete_Oc_Boat_Pla(String id) {
		List<EntityBeanOc_Boat_Pla> list=this.getHibernateTemplate().find("from EntityBeanOc_Boat_Pla where del='OFF' and id in("+id+")");	
		for(int i=0;i<list.size();i++)
		{
			EntityBeanOc_Boat_Pla e=list.get(i);
			e.setDel("ON");
			this.getHibernateTemplate().update(e);
			
		}
		
	}

	@SuppressWarnings("unchecked")
	public EntityBeanOc_Boat_Pla Find_EntityBeanOc_Boat_Pla(Integer id) {
		EntityBeanOc_Boat_Pla e=new EntityBeanOc_Boat_Pla();
		List<EntityBeanOc_Boat_Pla> list=this.getHibernateTemplate().find("from EntityBeanOc_Boat_Pla where id="+id);
		if(list.size()>0)
		{
			e=list.get(0);
		}
		return e;
	}

	public void Insert_Oc_Boat_Pla(EntityBeanOc_Boat_Pla e) {

		this.getHibernateTemplate().save(e);
	}

	public void Update_Oc_Boat_Pla(EntityBeanOc_Boat_Pla e) {
		this.getHibernateTemplate().update(e);
		
	}

	@SuppressWarnings("unchecked")
	public List<EntityBeanOc_Boat_Pla> Find_EntityBeanOc_Boat_Pla() {
		List<EntityBeanOc_Boat_Pla> list=new ArrayList<EntityBeanOc_Boat_Pla>();
		list=this.getHibernateTemplate().find("from EntityBeanOc_Boat_Pla where del='OFF'");
		return list;
	}
	@SuppressWarnings("unchecked")
	public List<EntityBeanOc_Boat_Pla> Find_Oc_Boat_Pla_By_oc_boatkind_Active()
	{
		List<EntityBeanOc_Boat_Pla> list=new ArrayList<EntityBeanOc_Boat_Pla>();
		list=this.getHibernateTemplate().find("from EntityBeanOc_Boat_Pla where del='OFF'");
		return list;
		
		
	}
	@SuppressWarnings("unchecked")
	public List<EntityBeanOc_Boat_Pla> Find_Oc_Boat_Pla_By_oc_boatkind(Integer id)
	{
		List<EntityBeanOc_Boat_Pla> list=new ArrayList<EntityBeanOc_Boat_Pla>();
		list=this.getHibernateTemplate().find("from EntityBeanOc_Boat_Pla where del='OFF' and oc_boatkind="+id);
		return list;
	}
}
